package com.forum.auth.feign;

import com.forum.auth.config.FeignConfig;
import com.forum.auth.model.UserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 用户服务客户端
 */
@FeignClient(name = "user-service", path = "/user", configuration = FeignConfig.class)
public interface UserServiceClient {
    
    /**
     * 验证用户凭据
     *
     * @param username 用户名
     * @param password 密码
     * @return 用户ID，认证失败返回null
     */
    @PostMapping("/internal/validate-credentials")
    Long validateCredentials(@RequestParam("username") String username, @RequestParam("password") String password);
    
    /**
     * 根据用户名获取用户ID
     *
     * @param username 用户名
     * @return 用户ID
     */
    @GetMapping("/internal/get-user-id-by-username")
    Long getUserIdByUsername(@RequestParam("username") String username);
    
    /**
     * 获取用户详细信息
     *
     * @param userId 用户ID
     * @return 用户详情
     */
    @GetMapping("/internal/get-user-details/{userId}")
    UserDTO getUserDetails(@PathVariable("userId") Long userId);
} 